<template>
    <div class="container">
        <a-table :columns="columns" :data-source="dataSource" :row-key="setRowKey" :pagination="pagination" :loading="loading">
            <template v-for="item in columns" :key="item.dataIndex" v-slot:[item.slotName]>
                <span>{{ t(`yl.${item.slotName}`) }}</span>
            </template>
        </a-table>
    </div>
</template>
<script lang="ts">
import { defineComponent, reactive, toRefs, onMounted, computed, createVNode, onUnmounted, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import columns from './storListColumns';
import useTables from './storListTables';
export default defineComponent({
    name: 'department',
    components: {},
    props: {
        row: {
            type: Object,
        },
    },
    setup(props) {
        const { t } = useI18n();
        // 搜索条件
        let { tableQuery, getMerchantStoreData, selectedRow, selectedRowKeys, visible } = useTables;
        const state = reactive({
            title: t('yl.addDept'),
            confirmLoading: false, // 弹窗按钮的loading
        });

        watch(
            () => props.row,
            (dept) => {
                if (JSON.stringify(dept) == '{}') return;

                const { areaCode } = dept as NormalObj;
                // formState.parentAreaCode = parentAreaCode;
                // formState.areaName = areaName;

                // formState.id = areaName;
                tableQuery.areaCode = areaCode;
                getMerchantStoreData(tableQuery);
            }
        );
        return {
            ...toRefs(state),
            t,
            columns,
            ...useTables,
        };
    },
});
</script>
<style lang="scss" scoped>
.container {
    width: 100%;
    &-filter {
        @include flex;
        &-item {
            margin-right: 20px;
        }
    }
    &-data {
        padding: $width20 $width0;
        .multi-action {
            background: $white;
        }
        .action-btn + .action-btn {
            margin-left: $width8;
        }
    }
}
</style>
